fix: release buffer when send log messages after max retry times#16
Conversation
Signed-off-by: Nic <qianyong@api7.ai>
This lib already has such a feature, lua-resty-logger-socket/lib/resty/logger/socket.lua Lines 341 to 342 in 5820faf By the way, we also cannot split the data here and send it multiple times because the log data itself has an encoding protocol. The main cause of this issue is that the user enabled the collection of request body and response body while using APISIX's syslog plugin, but did not set a size limit (we have informed the user to configure this limit). This caused the syslog plugin to attempt to use this library to send data exceeding the UDP protocol limit. Due to the bug mentioned in the PR description, it further led to subsequent logs that conform to protocol size also being unable to be sent. |


When using UDP as the transport protocol, due to the payload size limitation of UDP (65507), if there is a log line that exceeds this size limit and attempts to send,
_do_flushcall fails withEMSGSIZE. However, sincesend_bufferis not reset, all subsequent logs will still include the previous oversized log when sent again, causing continuous errors.refs:
lua-resty-logger-socket/lib/resty/logger/socket.lua
Line 155 in 5820faf
lua-resty-logger-socket/lib/resty/logger/socket.lua
Line 257 in 5820faf
lua-resty-logger-socket/lib/resty/logger/socket.lua
Line 289 in 5820faf